//
//  SLDownloadFileModel.h
//  Objective-C
//
//  Created by S_LINE on 2019/9/7.
//  Copyright © 2019 S_Line. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, SLDownloadState) {
    SLDownloadStatePaused = 1,
    SLDownloadStateWait,
    SLDownloadStateDownloading,
    SLDownloadStateFailed,
    SLDownloadStateFinish
};

@interface SLDownloadFileModel : NSObject

@property (nonatomic, copy) NSString *fileId;
/**
 * 展示的文件名
 */
@property (nonatomic, copy) NSString *showName;
/**
 * 实际的文件名
 */
@property (nonatomic, copy) NSString *fileName;
/**
 * 下载地址
 */
@property (nonatomic, copy) NSString *downloadUrl;
/**
 * 下载状态
 */
@property (nonatomic, strong) NSNumber *downloadState;
/**
 * 下载状态枚举值
 */
@property (nonatomic, assign) SLDownloadState downloadStateEnum;
/**
 * 下载进度
 */
@property (nonatomic, strong) NSNumber *progress;
/**
 * 下载的sessionDownloadTask
 */
@property (nonatomic, strong) NSURLSessionDownloadTask *downloadTask;
/**
 * 是否有已下载的进度
 */
@property (nonatomic, strong) NSData *resumeData;

#pragma mark - Methods
/**
 * 保存数据至持久化存储
 */
- (void)saveData;
/**
 * 获取fileNameLabel的frame
 */
- (CGRect)fileNameLabelFrame;
/**
 * 获取downloadStateLabel的frame
 */
- (CGRect)downloadStateLabelFrame;
/**
 * 获取当前下载状态的描述文案
 */
- (NSString *)getDownloadStateDesc;
/**
 * 获取downloadProgressLabel的frame
 */
- (CGRect)downloadProgressLabelFrame;
- (CGFloat)cellHeight;

@end
